<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        这是你第<span  id="visitCount"> </span>访问页面
        <br/>
        <h3>你的访问记录如下</h3>
        <div id="d1">



        </div>

    </div>
    <script>
      var  visitList=    localStorage.visitList;
      if(visitList){
          visitList=JSON.parse(visitList);
      }
      else{
          visitList=[];
      }
     var visit={
         visitTime:new Date().toLocaleString()
     }
     visitList.unshift(visit);
     visitCount.innerHTML=visitList.length;
     for (var i = 0;  i < visitList.length;  i++) {
     var    newdivs=    document.createElement("div");
     newdivs.innerHTML=visitList[i].visitTime;
     d1.append(newdivs);
        
         
     }
     localStorage. visitList= JSON.stringify(visitList);
     






    </script>
    
</body>
</html>